package com.huanong.service.impl;

import com.huanong.mapper.OrderMapper;
import com.huanong.pojo.Order;
import com.huanong.pojo.vo.OrderVo;
import com.huanong.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/*
 *@Author:anran
 *@Date:2020/12/9
 *@Version 1.0
 */

@Service
public class OrderServiceImpl  implements OrderService {

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public List<Order> query() {
        return orderMapper.queryOrder();
    }

    @Override
    public Order queryById(Integer OsId) {
        return orderMapper.queryOrderById(OsId);
    }

    @Override
    public int add(OrderVo order) {
        order.setOsTime(new Date());
        return orderMapper.addOrder(order);
    }

    @Override
    public int delete(Integer OsId) {
        return orderMapper.deleteOrder(OsId);
    }

    @Override
    public void updataStatus(OrderVo order) {
        orderMapper.updataOrderStauts(order);
    }

    @Override
    public List<Order> queryByUserid(Integer psId) {

        return orderMapper.queryOrderByUserid(psId);
    }
}
